package com.jianbing.redisdemo.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;

/**
 * @ClassName : RedissionConfiguration
 * @Description :
 * @Author : JB
 * @Date: 2020-11-29 17:34
 */


public class RedissionConfiguration {
    @Bean
    public RedissonClient getRedissionClient(){
        Config config=new Config();
        //集群模式,集群节点的地址须使用“redis://”前缀，否则将会报错。
        //此例集群为3节点，各节点1主1从
        config.useClusterServers().addNodeAddress("redis://127.0.0.1:7001","redis://127.0.0.1:7002",
                "redis://127.0.0.1:7003","redis://127.0.0.1:7004","redis://127.0.0.1:7005","redis://127.0.0.1:7006");
        return Redisson.create(config);
    }
}
